import 'package:flutter/material.dart';

class WidgetScreenMainLeftMenu extends StatefulWidget {
  const WidgetScreenMainLeftMenu({super.key, this.onChanged});

  final ValueChanged<String>? onChanged;

  @override
  State<WidgetScreenMainLeftMenu> createState() => _WidgetScreenMainLeftMenuState();
}

class _WidgetScreenMainLeftMenuState extends State<WidgetScreenMainLeftMenu> {
  @override
  Widget build(BuildContext context) {
    return ListView(
      shrinkWrap: true,
      children: <Widget>[
        TextButton(
            onPressed: () {
              op("showIndex");
            },
            child: Text("首页")),
        TextButton(
            onPressed: () {
              op("showNet");
            },
            child: Text("网络资源")),
        TextButton(
            onPressed: () {
              op("showLocal");
            },
            child: Text("本地内容")),
        TextButton(
            onPressed: () {
              op("showMy");
            },
            child: Text("我的学习")),
      ],
    );
  }

  void op(String opStr) {
    print("op:${opStr}");
    widget.onChanged!(opStr);
  }
}
